package com.journey.org.ui.splash

import android.app.Application
import androidx.databinding.ObservableBoolean
import androidx.databinding.ObservableInt
import com.journey.org.ui.MainActivity
import com.mvvmhabit.org.base.BaseViewModel
import com.mvvmhabit.org.binding.command.BindingAction
import com.mvvmhabit.org.binding.command.BindingCommand

/**
 * @Date: 2021/2/5 14:01
 * @Author:小妖
 * @Description: 欢迎界面
 */
class SplashViewModel(application: Application) : BaseViewModel(application) {

    val isEnterMainField = ObservableBoolean(false)

    val onTimeChangeField = ObservableInt(3)

    val onClickFinishCommand = BindingCommand<Any>(object : BindingAction {
        override fun call() {
            if (onTimeChangeField.get() <= 2) {
                isEnterMainField.set(true)
                startActivity(MainActivity::class.java, null)
                finish()
            }
        }
    })

}